<?php
require_once 'api/utils/Response.php';

header('Content-Type: application/json');

try {
    // 检查数据库连接
    require_once 'api/config/database.php';
    $database = new Database();
    $conn = $database->getConnection();
    
    if ($conn) {
        $response = [
            'status' => 'healthy',
            'timestamp' => date('Y-m-d H:i:s'),
            'services' => [
                'database' => 'connected',
                'api' => 'running'
            ],
            'version' => '1.0.0'
        ];
        
        Response::success($response, '系统运行正常');
    } else {
        Response::error('数据库连接失败', 500);
    }
} catch (Exception $e) {
    Response::error('系统异常: ' . $e->getMessage(), 500);
}
?>